<?php
	session_start();
	include('../functions/soap.php');
	include('head.php');

	if(isset($_GET['id']))
	{
		$stage_id = $_GET['id'];
		$detailStage = new GetStage($wsdl);
		$stage_obj = $detailStage->getStage($stage_id);
	}
	
	//Kijk of er is ingelogd
	if(!isset($_SESSION['session']))
	{
		header('Location: ../');
	}
?>

<body>
    <div class="wrapper">
    	<div class="header"><img src="../img/logo.gif" /></div>
        <?php include('logininfo.php') ?>
        <div class="menu"><?php include('menu.php'); ?></div>
		<div class="sidebar">

			<?php include('../copyrightBox.php') ?>

		</div>
        
    	<div class="content">
        	<h3 class="header">Stage details</h3>
            <table>
            <tr>
            	<td><b>Student 1</b></td>
            	<td>
			<?php
            	$GetStudent = new GetStudent($wsdl);
				$student = $GetStudent->getStudent($stage_obj->getStudent1());
				echo $student->getFullName();
			?></td>
            </tr>
            <?php if($stage_obj->getStudent2() != NULL)
				  {
			?>
            <tr>
            	<td><b>Student 2</b></td>
                <td>
            <?php
				$student = $GetStudent->getStudent($stage_obj->getStudent2());
				echo $student->getFullName();
			?></td>
            <?php } ?>
            </tr>
            <tr>
            	<td><b>Van</b></td>
            	<td>
			<?php
				echo $stage_obj->getVan();
			?></td>
            </tr>
			<tr>
            	<td><b>Tot</b></td>
            	<td>
            <?php
				echo $stage_obj->getTot();
			?></td>
            </tr>
            <tr>
            	<td><b>Docent</b></td>
                <td>
            <?php
            	$GetDocent = new GetDocent($wsdl);
				$docent = $GetDocent->getDocent($stage_obj->getDocent());
				echo $docent->getFullName();
			?></td>
            </tr>
            <tr>
            	<td><b>Bedrijfsbegeleider</b></td>
            	<td>
            <?php
            	$GetContact = new GetContact($wsdl);
				$contact = $GetContact->getContact($stage_obj->getBedrijfsbegeleider());
				echo $contact->getFullName();
			?></td>
            </tr>
            <tr>
            	<td><b>Bedrijf</b></td>
            	<td>
            <?php
            	$GetBedrijf = new GetBedrijf($wsdl);
				$bedrijf = $GetBedrijf->getBedrijf($contact->getBedrijf());
				echo $bedrijf->getBedrijfsnaam();
			?></td>
            </tr>
            <tr>
            	<td><b>Type</b></td>
            	<td>
            <?php
				echo $stage_obj->getType();
			?></td>
            </tr>
            </table>
            
            <?php
				echo('<br />><a href="student_overzicht.php">Terug naar overzicht</a>');
			?>
        </div>
    </div>
</body>
</html>